package com.evil.application.pojo.dto.robot;

import cn.hutool.core.bean.BeanUtil;
import com.evil.common.application.dto.robot.RobotSourceDTO;
import com.evil.common.application.enums.ApplicationVersionEnum;
import com.evil.common.application.enums.robot.RobotSourceTypeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;

/**
 * 新增机器人信息 请求实体
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class AddApplicationRobotReqDTO extends ApplicationRobotDTO {

    @NotBlank(message = "应用key不能为空")
    private String applicationKey;

    public AddRobotReqDTO toAddRobotReqDTO(Long sourceId) {
        AddRobotReqDTO addRobotReqDTO = BeanUtil.copyProperties(this, AddRobotReqDTO.class);
        addRobotReqDTO.setSource(new RobotSourceDTO(RobotSourceTypeEnum.APPLICATION_ROBOT, sourceId, ApplicationVersionEnum.DESIGN_VERSION.getId()));
        return addRobotReqDTO;
    }
}
